<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>精选板块走势图</title>
		<link href="css/text.css" rel="stylesheet" type="text/css" />
		<style type="text/css">							
			.fixedBox{
				border: 1px solid #555555;				
				white-space: nowrap;	
			}
			.fixedBox::-webkit-scrollbar {
				width: 10px;     
				height: 10px;				
			}
			
			table{
				width:240px; 
				border-collapse:collapse; 
				text-align:center;
			}
			td,th{border:1px solid #696969}	
			
			input[type=range]{ 
				margin-top: 8px;
				outline: none; 
				-webkit-appearance: none;/*清除系统默认样式*/  
				background: -webkit-linear-gradient(#FF8C00, #FF8C00) no-repeat, #ddd;  				
				height: 3px;/*横条的高度*/  
			} 
			 /*拖动块的样式*/  
			input[type=range]::-webkit-slider-thumb {  
				-webkit-appearance: none;/*清除系统默认样式*/  
				height:14px;/*拖动块高度*/  
				width: 14px;/*拖动块宽度*/  
				background: #FFFFF0;/*拖动块背景*/ 
				border-radius: 50%; /*外观设置为圆形*/  
				border: solid 1px #ddd; /*设置边框*/  
			}
						
		</style>
	</head>
	<body>
		<div id="towriter" class="fixedBox" style="display:none;">
			<div id="towrite" class="fixedBox" style="position:relative;">
				<div id="d1" class="fixedBox" style="position:relative;">					
					<div id="towrite1" class="fixedBox" style="position:relative; float:left;">
						<div id="bara1" style="height:20px;width:90%;float:left;margin-bottom:-3px;"></div>
					</div>
					<div id="barb1" style="height:20px;width:60%;float:left;font-size:14px;"></div>
					<iframe id="mapIframe1" style="position:relative; float:left;"></iframe>
				</div>
				<div id="d2" class="fixedBox" style="position:relative;">
					<div id="towrite2" class="fixedBox" style="position:relative; float:left;">
						<div id="bara2" style="height:20px;width:90%;float:left;margin-bottom:-3px;"></div>
					</div>
					<div id="barb2" style="height:20px;width:60%;float:left;font-size:14px;"></div>
					<iframe id="mapIframe2" style="position:relative; float:left;"></iframe>
				</div>
			</div>
		</div>
		<script type="text/javascript" src="js/json2html.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script>
			var bkcolor = $("body").css("backgroundColor")	
			var w = 2; //w = 1 读取“自选股.txt”；w = 2 读取指定板块文件；
			window.onload = function() {							
				changeStyle();
				kplbk();
			}
			
			function time_range(beginTime, endTime) {
				var strb = beginTime.split(":");
				if (strb.length != 2) {
					return false;
				}

				var stre = endTime.split(":");
				if (stre.length != 2) {
					return false;
				}

				var b = new Date();
				var e = new Date();
				var n = new Date();

				b.setHours(strb[0]);
				b.setMinutes(strb[1]);
				e.setHours(stre[0]);
				e.setMinutes(stre[1]);

				if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {
					kplbk();
					//changeCss1(objt1,trid1,"bk");
					
					kplgg(dms);					
					//changeCss(objt,trid,"gg");						
					
					console.log(true)　　　　　　
					return true;				
				} else {
					console.log(false)
				    return false;     
				}
			}　　　
   　　　
			$(function() {
				setInterval(function() {
					time_range("9:00","15:15")						
				},
				30000);
			})
			
			function changeStyle() {
				var obj = document.getElementById("towriter");
				obj.style.border= "none";
				obj.style.display= "block";
				obj.style.left= "0px"; 				
				obj.style.width= "100%";	
				
				var div = document.getElementById("towrite");	
				//div.style.border= "3px solid #fff";
				div.style.border= "none";
				div.style.marginTop= "-20px";				
				div.style.left= "0px"; 				
				div.style.width= "96%";	//此处调宽度
				div.style.height= "100%";
				
				var d1 = document.getElementById("d1");
				//d1.style.border= "2px solid #fff";
				d1.style.border= "none";
				d1.style.left= "-5px"; 				
				d1.style.width= "98%";
				d1.style.height= "45%";
				
				var d2 = document.getElementById("d2");
				//d2.style.border= "2px solid #fff";
				d2.style.border= "none";
				d2.style.left= "-5px"; 				
				d2.style.width= "98%";	
				d2.style.height= "50%";
				
				var div1 = document.getElementById("towrite1");	
				div1.style.border= "1px solid #696969";
				div1.style.margin= "-8px 0px 0px -5px";
				div1.style.left= "0px"; 				
				div1.style.width= "260px";	
				div1.style.height= "98%";		
				div1.style.fontSize="12px";	
				
				var obj1 = document.getElementById("mapIframe1");	
				obj1.style.border= "1px solid #696969";
				obj1.style.float= "left"; 
				obj1.style.left= "0px";
				obj1.style.marginTop= "-5px";
				obj1.style.width= "500px";
				obj1.style.height= "88%";					
				obj1.style.fontSize="12px";				
				
				var div2 = document.getElementById("towrite2");	
				div2.style.border= "1px solid #696969";	
				div2.style.left= "0px"; 
				div2.style.margin= "-8px 0px 0px -5px";
				div2.style.width= "260px";	
				div2.style.height= "98%";		
				div2.style.fontSize="12px";		
				
				var obj2 = document.getElementById("mapIframe2");	
				obj2.style.border= "1px solid #696969";
				obj2.style.float= "left"; 
				obj2.style.left= "0px";
				obj2.style.marginTop= "-5px";
				obj2.style.marginBottom= "-20px";
				obj2.style.width= "500px";
				obj2.style.height= "88%";					
				obj2.style.fontSize="12px";						
			}	
						
			Date.prototype.Format = function (fmt) {
				var o = {
				"M+": this.getMonth() + 1, //月份
				"d+": this.getDate(), //日
				"h+": this.getHours(), //小时
				"m+": this.getMinutes(), //分
				"s+": this.getSeconds(), //秒
				"q+": Math.floor((this.getMonth() + 3) / 3), //季度
				"S": this.getMilliseconds() //毫秒
				};
				if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
				return fmt;
			};
			
			function keepTwoDecimal(num) {  
               var result = parseFloat(num);  
               if (isNaN(result)) {  
                   //alert('传递参数错误，请检查！');  
                   return false;  
               }  
               result = Math.round(num * 100) / 100;  
               return result;  
			};
						
			var order1 = 1;
			var type1 = 1;
			function kplbk() {
				var url = "https://apphq.longhuvip.com/w1/api/index.php?Order=" + order1 + "&a=RealRankingInfo&st=30&apiv=w21&Type=" + type1 + "&c=ZhiShuRanking&PhoneOSNew=1&ZSType=7&"; 								
				var res = [];
				$.ajax({
					type: "get",
					url: url,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))						
						//document.write(JSON.stringify(data));
						var j = 0;
						for (var i = 0; i < data.list.length; i++){
							var dm = data.list[i][0];
							var mc = data.list[i][1];
							if(i == 0 && dms == ""){
								dms = dm + "##" + mc;
								kplgg(dms);
							}
							if(mc.indexOf('ST') == -1){
								res.push({"code":dm,"name":mc,"qd":data.list[i][2],"zf":keepTwoDecimal(data.list[i][3])});
								j++;
							}								
							if(j == 20){
							 break;
							}
						}											
					}
				});
				
				var div = document.getElementById('bara1');
				div.innerHTML = '<font size = "2" style="color:#FFD700;">精选板块</font>';				
				table1(res);
				//changeCss1(objt1,trid1,"bk");
				changeCssbk(objt1,trid1,"bk");				
			}
			
			var dms = "";
			var order = 1;
			function kplgg(ss) {
				dms = ss;
				if(ss != ""){
					var aa = ss.split('##');
					bkdm = aa[0];
					bkmc = aa[1];
					var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=" + order + "&st=30&a=ZhiShuStockList_W8&c=ZhiShuRanking&old=0&apiv=w21&Type=6&PlateID=" + bkdm; 												
					var res1 = [];
					$.ajax({
						type: "get",
						url: url1,
						dataType: "json",
						async : false,
						cache:false,
						timeout:3000,					
						success: function(data) {
							//alert(JSON.stringify(data))					
							//document.write(JSON.stringify(data));							
							
							for (var i = 0; i < data.list.length; i++){								
								res1.push({"code":data.list[i][0],"name":data.list[i][1],"zf":data.list[i][6]});							
							}											
						}
					});	
					
					var div = document.getElementById('bara2');
					div.innerHTML = '<font size = "2" style="color:#FFD700;">' + bkmc + '</font>';
					table(res1);
					changeCssgg(objt,trid,"gg");
				}
			}
			
			
			function table(res) {  //gg
				var div = document.getElementById("towrite2");
				var oTable = document.getElementById('gg');
				if(oTable){
					div.removeChild(oTable);  //清除table
				}
				
				var json = res;					
				//创建table					
				var table=document.createElement("table");										
				var thead=document.createElement("thead");
				table.appendChild(thead);					
				var tr=document.createElement("tr");
				thead.appendChild(tr);					
				
				var m = 0;
				var n = 0;
				var b = 0;
				//var gl = "涨幅";  //高亮
				for(var key in json[0]){  //表头
					key = key.replace('code','代码').replace('name','名称').replace('zf','涨幅%').replace('xj','现价').replace('hsl','换手率%');
					var th=document.createElement("th");						
					th.innerHTML=key;						
					tr.appendChild(th);					
					
					if(m == rn){
						th.style.color = "#FFFF80";						
					}
					m++;
				}
									
				var tbody=document.createElement("tbody");					
				table.appendChild(tbody);
				
				//遍历json
				for(var i = 0; i < json.length; i++){					
					var tr=document.createElement("tr");						
					var p = 1;
					var dm = "";
					var mc = "";
					for(var key in json[i]){ //行元素遍历						
						var td=document.createElement("td");							
						
						var rc = json[i][key];
						//alert(rc)
						if(p == 1){  //代码列
							dm = rc;
							tr.id = "trids";							
						}else if(p == 2){
							mc = rc;
							tr.id = dm + "##" + mc;
						}
						
						//联动通达信
						//td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p + "' onclick='getfs(\"" + dm + "\",1);changeCss(this,\"" + tr.id + "\",\"gg\")'>" + rc.replace(/(sh)|(sz)/g,"") + "</a>";
						
						//不联动
						td.innerHTML = "<a href='javascript:void(0)' id='" + p + "' onclick='getggfs(\"" + tr.id + "\",0);changeCss(this,\"" + tr.id + "\",\"gg\")'>" + rc.toString().replace(/(sh)|(sz)/g,"") + "</a>";
						//td.innerHTML.replace("trids",tr.id);
						
						if(p == rn + 1){							
							if(parseFloat(td.getElementsByTagName("a")[0].innerText) >= 0){
								td.getElementsByTagName("a")[0].style.color = "#FF6633";
							}else{
								td.getElementsByTagName("a")[0].style.color = "#00FF00";								
							}							
						}
						tr.innerHTML = tr.innerHTML.replace(/trids/g,tr.id);														
						tr.appendChild(td);							
						p++;
					}														
					tbody.appendChild(tr);																
				}					
				
				div.appendChild(table);
				table.id = "gg";
				<!-- table.style.marginTop = "5px"; -->
				<!-- if(sx == 2){ -->
					<!-- table.style.border= "2px solid #C0C0C0"; -->
				<!-- } -->
				hover();
				makeSortable(table);
			}
			
			<!-- var objt = ""; -->
			<!-- var trid = ""; -->
			<!-- function changeCss(obj,hid,id){	  //gg -->
				<!-- if(obj){ -->
					<!-- objt = obj; -->
					<!-- var tlist = document.getElementById(id).getElementsByTagName("tr");									 -->
					<!-- for(var i = 0; i < tlist.length; i++){ -->
						<!-- tlist[i].style.backgroundColor = bkcolor;			 -->
					<!-- } -->
					<!-- trid = hid; -->
					<!-- var tr = document.getElementById(hid); -->
					<!-- tr.style.backgroundColor = "#483D8B"; -->
				<!-- } -->
			<!-- } -->
			
			var trs = "";
			var trid = "";
			var objt = "";
			function changeCss(obj,hid,id){	//gg
				if(obj){
					objt = obj;
					var tlist = document.getElementById(id).getElementsByTagName("tr");															
					trs = "";
					var j = 0;
					for(var i = 0; i < tlist.length; i++){
						if(ggdd == "单股" && (tlist[i].id == hid || ( j > 0 && j < 4))){
							j++;
							tlist[i].style.backgroundColor = "#696969";
							trs += tlist[i].id;
						}else{					
							tlist[i].style.backgroundColor = bkcolor; 
						}					
					}
					trid = hid;
					var tr = document.getElementById(hid);
					if(tr){
						tr.style.backgroundColor = "#483D8B";
					}
				}
			}
			
			function changeCssgg(obj,hid,id){
				var tlist = document.getElementById(id).getElementsByTagName("tr");					
				for(var i = 0; i < tlist.length; i++){				
					if(trs.indexOf(tlist[i].id) > -1 && tlist[i].id != ""){
						if(tlist[i].id == hid ){						
							tlist[i].style.backgroundColor = "#483D8B";
						}else{
							tlist[i].style.backgroundColor = "#696969";
						}
					}else{					
						tlist[i].style.backgroundColor = bkcolor; 
					}					
				}				
			}
			
			function hover(){  //鼠标经过	gg			
				var rows = document.getElementById("gg").getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){						
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}
					rows[i].onmouseout=function(){
						if(this.id != ""){  //过滤表头
							if(this.id != trid){  //过滤选中行
								if(trs.indexOf(this.id)>-1){
									this.style.background = "#696969";
								}else{
									this.style.background = bkcolor;
								}
							}else{
								this.style.background ="#483D8B";
							}
						}						
					}					
				}
			}			
			
			var rn = 2;
			var sfx = 0;  //自动刷新开关
			var fls = false;  //排序方向
			function makeSortable(table) {  //gg
				var headers=table.getElementsByTagName("th");
				for(var i=0;i<headers.length;i++){				
					(function(n){
						var flag=true;
							
						headers[n].onclick=function(){
							rn = n;
							
							if(n == 2){
								if(order == 1){
									order = 0;									
								}else{
									order = 1;									
								}
								kplgg(dms);
							}
							//alert(n)
							showCol(n);		//高亮
							//changeCss(objt,trid,"gg");
							
							var tbody=table.tBodies[0];
							var rows=tbody.getElementsByTagName("tr");
							rows=Array.prototype.slice.call(rows,0);

							//基于第n个<td>元素的值对行排序
							rows.sort(function(row1,row2){
								headtxt = headers[n].textContent;								
								var cell1=row1.getElementsByTagName("td")[n];//获得第n个单元格
								var cell2=row2.getElementsByTagName("td")[n];																
								var val1=cell1.textContent||cell1.innerText;//获得文本内容
								var val2=cell2.textContent||cell2.innerText;
								if(headtxt.indexOf("名称") != -1){
									val1 = val1;
									val2 = val2;
								}else{									
									val1 = parseFloat(val1)									
									val2 = parseFloat(val2);									
								}
								if(val1<val2){
									return 1;
								}else if(val1>val2){
									return -1;
								}else{
									return 0;
								}
							});
							
							if(sfx == 1){   //自动刷新时，保持排序方向
								flag = fls;								
							}
							fls = flag;							
							sfx = 0;
							
							if(flag){
								rows.reverse();
							}
							
							for(var i=0;i<rows.length;i++){
								tbody.appendChild(rows[i]);
							}

							flag=!flag;
						}
					}(i));
				}
			}
			
			function showCol(iCol){			//gg
				//var oTable = document.getElementsByTagName('table')[0];
				var oTable = document.getElementById("gg");
				for (i=0;i < oTable.rows.length; i++){										
					for (j=0;j < oTable.rows[0].cells.length; j++){
						oTable.rows[i].cells[j].style.color = "#E5E5E5";								
					}
					oTable.rows[i].cells[iCol].style.color = "#FFFF80";					
				}

				otagsA = oTable.getElementsByTagName("a");  //a变色
				for (i = 0; i < otagsA.length; i++) {
					otagsA[i].style.color = "#E5E5E5";					
					if(otagsA[i].id == iCol + 1){					
						otagsA[i].style.color = "#FF6633";
						
						if(otagsA[i].id == rn + 1 && parseFloat(otagsA[i].innerText) < 0){
							otagsA[i].style.color = "#00FF00";
						}
					}
				}								
			}
			
			
			function table1(res) {  //kplbk
				var div = document.getElementById("towrite1");				
				var oTable = document.getElementById('bk');
				if(oTable){
					div.removeChild(oTable);  //清除table
				}
				var json = res;					
				//创建table					
				var table=document.createElement("table");										
				var thead=document.createElement("thead");
				table.appendChild(thead);					
				var tr=document.createElement("tr");
				thead.appendChild(tr);					
				
				var m = 0;
				for(var key in json[0]){  //表头
					key = key.replace('code','代码').replace('name','名称').replace('zf','涨幅%').replace('qd','强度');
					var th=document.createElement("th");						
					th.innerHTML=key;						
					tr.appendChild(th);
					if(m == rn1){
						th.style.color = "#FFFF80";						
					}
					m++;
				}
									
				var tbody=document.createElement("tbody");					
				table.appendChild(tbody);
				
				//遍历json
				for(var i = 0; i < json.length; i++){					
					var tr=document.createElement("tr");						
					var p = 1;
					var dm = "";
					var mc = "";
					for(var key in json[i]){ //行元素遍历						
						var td=document.createElement("td");							
						
						var rc = json[i][key];
						//alert(rc)
						if(p == 1){  //代码列
							dm = rc;
							tr.id = "bkid";							
						}else if(p == 2){
							mc = rc;
							tr.id = dm + "##" + mc;
						}
						
						td.innerHTML = "<a href='javascript:void(0)' id='" + p + "' onclick='kplgg(\"" + tr.id + "\");getbkfs(0);changeCss1(this,\"" + tr.id + "\",\"bk\")'>" + rc + "</a>";
						if(p == rn1 + 1){							
							if(parseFloat(td.getElementsByTagName("a")[0].innerText) >= 0){
								td.getElementsByTagName("a")[0].style.color = "#FF6633";
							}else{
								td.getElementsByTagName("a")[0].style.color = "#00FF00";								
							}							
						}
						tr.innerHTML = tr.innerHTML.replace(/bkid/g,tr.id);
						tr.appendChild(td);							
						p++;
					}					
					tbody.appendChild(tr);					
				}					
				
				div.appendChild(table);
				table.id = "bk";				
				hover1();
				makeSortable1(table);
			}
			
			var trs1 = "";
			var trid1 = "";
			var objt1 = "";
			function changeCss1(obj,hid,id){	//kplbk
				if(obj){
					objt1 = obj;
					var tlist = document.getElementById(id).getElementsByTagName("tr");															
					trs1 = "";
					var j = 0;
					for(var i = 0; i < tlist.length; i++){
						if(bkdd == "单股" && (tlist[i].id == hid || ( j > 0 && j < 4))){
							j++;
							tlist[i].style.backgroundColor = "#696969";
							trs1 += tlist[i].id;
						}else{					
							tlist[i].style.backgroundColor = bkcolor; 
						}					
					}
					trid1 = hid;
					var tr = document.getElementById(hid);
					if(tr){
						tr.style.backgroundColor = "#483D8B";
					}
				}
			}
			
			function changeCssbk(obj,hid,id){
				var tlist = document.getElementById(id).getElementsByTagName("tr");					
				for(var i = 0; i < tlist.length; i++){				
					if(trs1.indexOf(tlist[i].id) > -1 && tlist[i].id != ""){
						if(tlist[i].id == hid ){						
							tlist[i].style.backgroundColor = "#483D8B";
						}else{
							tlist[i].style.backgroundColor = "#696969";
						}
					}else{					
						tlist[i].style.backgroundColor = bkcolor; 
					}					
				}				
			}
			
			function hover1(){  //鼠标经过			kplbk	
				var rows = document.getElementById("bk").getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){						
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}
					rows[i].onmouseout=function(){
						if(this.id != ""){  //过滤表头
							if(this.id != trid1){  //过滤选中行
								if(trs1.indexOf(this.id)>-1){
									this.style.background = "#696969";
								}else{
									this.style.background = bkcolor;
								}
							}else{
								this.style.background ="#483D8B";
							}
						}						
					}					
				}
			}			
			
			
			var rn1 = 2;
			function makeSortable1(table) {   //kplbk
				var headers=table.getElementsByTagName("th");
				for(var i=0;i<headers.length;i++){				
					(function(n){						
						headers[n].onclick=function(){
														
							if(n >= 2){
								rn1 = n;
								if(order1 == 1){
									order1 = 0;									
								}else{
									order1 = 1;									
								}
								if(n == 2){
									type1 = 1;
								}else if(n == 3){
									type1 = 2;
								}
								kplbk();
							}
							//alert(n)
							<!-- showCol(n);		//高亮 -->
							<!-- changeCss1(objt,trid,"gg"); -->							
						}
					}(i));
				}
			}
			
			
			
			var bp = 1;
			var ts1 = 100;
			var bkdd = "多股";
			function getbkfs(p){				
				if(p != 0){
					bp = p;
				}
				var div = document.getElementById('barb1');
				var fs = "<span><a href='javascript:void(0)' id='b1' style='padding-left:20px;' onclick='getbkfs(1);'>分时</a></span>";
				var kx = "<span><a href='javascript:void(0)' id='b2' onclick='getbkfs(2);'>K线</a></span>";
				var dt = "<span><a href='javascript:void(0)' id='dt1' style='position:absolute; left:750px;' onclick='getbkqh();'>" + bkdd + "</a></span>";
				var t1 = '<font style="padding-left:10px;">1</font>' + '<input type="range" style="width:150px;" id="val1" value=' + ts1 + ' min="1" max="500" step="1" /><font>500</font>'
				var t2 = '<label id="fPrice1" style="padding:0px 10px 0px 15px;">' + ts1 + '天</label>';
				
				//div.innerHTML = '<font size="2" style="padding-left:10px;color:#FFFFF0;">' + bkdm + "&nbsp;&nbsp;&nbsp;" + bkmc + '</font>' + fs + kx;
				div.innerHTML = fs + kx + dt;
				if(bp == 2){
					div.innerHTML = fs + kx + dt + t1 + t2;
				}
				
				var aObj = document.getElementById("b" + bp);
				aObj.style.color = "#FFA500";
				
				if(bkdd == "多股" ){
					var url = "kpl-分时图.html##" + bkdm + "##" + bkmc + "##0";				
					if(bp == 2){
						url = "kpl-K线图.html##" + bkdm + "##" + bkmc + "##0##" + ts1;	
					}
					var iframe = document.getElementById('mapIframe1');
					iframe.src = url;
				}else{
					getbkdt();					
				}				
			}
			
			function getbkdt(){
				for (var i = 1; i < 5; i++) {					
					destroyIframe('framebk'+ i)
				}	
				var j = 0;
				var tlist = document.getElementById("bk").getElementsByTagName("tr");					
				for(var i = 1; i < tlist.length; i++){						
					var ss = tlist[i].id.split('##'); 
					var dm = ss[0];
					var mc = ss[1];
					if(bkdm == dm || j > 0){
						j++;
						var url = "kpl-分时图.html##" + dm + "##" + mc + "##0";				
						if(bp == 2){
							url = "kpl-K线图.html##" + dm + "##" + mc + "##0##" + ts1;	
						}
						var iframe = document.getElementById('framebk'+ j);
						iframe.src = url;						
					}						
					if(j == 4){
						break;
					}
				}
				changeCss1(objt1,trid1,"bk");
			}
			
			function getbkqh(){				
				var div = document.getElementById('d1');
				var iframe = document.getElementById('mapIframe1');
				var div1 = document.getElementById("bkdt");
				var Obj = document.getElementById('dt1');
				if(Obj.innerText == "多股"){
					Obj.innerText = "单股"
					bkdd = "单股";		
					iframe.style.display = "none";
					if(div1 == null){
						div1 = document.createElement("div");
						div1.id = "bkdt";
						//div1.style.border= "1px solid #fff";
						div1.style.position= "relative"; 
						div1.style.float= "left"; 
						div1.style.left= "0px";
						div1.style.marginTop= "-5px";
						div1.style.width= "500px";
						div1.style.height= "86%";					
						div1.style.fontSize="12px";						
						div.appendChild(div1);					
						for (var i = 1; i <= 4; i++){
							var obj = document.createElement("iframe");
							obj.id = "framebk" + i;
							//obj.className = "fixedBox";
							//obj.style.border= "none";
							obj.style.border= "1px solid #696969";
							obj.style.position= "relative"; 
							obj.style.float= "left"; 
							obj.style.left= "0px";
							//obj.style.marginTop= "-10px";
							obj.style.width= "48%";
							obj.style.height= "50%";					
							obj.style.fontSize="12px";
							//obj.style.transform= "scale(0.5)";

							div1.appendChild(obj);					
						}
					}else{
						div1.style.display = "block";
					}
					getbkdt();							
				}else{
					bkdd = "多股";
					div1.style.display = "none";						
					getbkfs(bp);
					iframe.style.display = "block";	
					changeCss1(objt1,trid1,"bk");
				}
			}
			
			var ggdd = "多股";
			var ggdms = "";
			var ggdm = "";
			var gp = 1;
			var ts2 = 100;
			function getggfs(ss,p){
				if(p != 0){
					gp = p;
				}
				if(ss != ggdms){
					ggdms = ss;
				}
				
				var aa = ss.split('##');
				ggdm = aa[0];
				ggmc = aa[1];
				var div = document.getElementById('barb2');
				var fs = "<span><a href='javascript:void(0)' id='g1' style='padding-left:20px;' onclick='getggfs(\"" + ss + "\",1);'>分时</a></span>";
				var kx = "<span><a href='javascript:void(0)' id='g2' onclick='getggfs(\"" + ss + "\",2);'>K线</a></span>";
				var dt = "<span><a href='javascript:void(0)' id='dt2' style='position:absolute; left:750px;' onclick='getggqh();'>" + ggdd + "</a></span>";
				var t1 = '<font style="padding-left:10px;">1</font>' + '<input type="range" style="width:150px;" id="val2" value=' + ts2 + ' min="1" max="500" step="1" /><font>500</font>'
				var t2 = '<label id="fPrice2" style="padding:0px 10px 0px 15px;">' + ts2 + '天</label>';
				
				//div.innerHTML = '<font size="2" style="padding-left:10px;color:#FFFFF0;">' + ggdm  + "&nbsp;&nbsp;&nbsp;" + ggmc + '</font>' + fs + kx;
				div.innerHTML = fs + kx + dt;
				if(gp == 2){
					div.innerHTML = fs + kx + dt + t1 + t2;
				}
				var aObj = document.getElementById("g" + gp);
				aObj.style.color = "#FFA500";
				
				if(ggdd == "多股" ){
					var url = "东财分时图.html##" + ggdms + "##00";				
					if(gp == 2){
						url = "东财K线图.html##" + ggdms + "##0##" + ts2;	
					}
					var iframe = document.getElementById('mapIframe2');
					iframe.src = url;
				}else{
					getggdt();					
				}				
			}
						
			function getggdt(){
				for (var i = 1; i < 5; i++) {					
					destroyIframe('framegg'+ i)
				}	
				var j = 0;
				var tlist = document.getElementById("gg").getElementsByTagName("tr");					
				for(var i = 1; i < tlist.length; i++){						
					var ss = tlist[i].id.split('##'); 
					var dm = ss[0];
					var mc = ss[1];
					if(ggdm == dm || j > 0){
						j++;
						var url = "东财分时图.html##" + dm + "##" + mc + "##0";				
						if(gp == 2){
							url = "东财K线图.html##" + dm + "##" + mc + "##0##" + ts2;	
						}
						var iframe = document.getElementById('framegg'+ j);
						iframe.src = url;						
					}						
					if(j == 4){
						break;
					}
				}
				changeCss(objt,trid,"gg");
			}
			
			function getggqh(){				
				var div = document.getElementById('d2');
				var iframe = document.getElementById('mapIframe2');
				var div1 = document.getElementById("ggdt");
				var Obj = document.getElementById('dt2');
				if(Obj.innerText == "多股"){
					Obj.innerText = "单股"
					ggdd = "单股";		
					iframe.style.display = "none";
					if(div1 == null){
						div1 = document.createElement("div");
						div1.id = "ggdt";
						//div1.style.border= "1px solid #fff";
						div1.style.position= "relative"; 
						div1.style.float= "left"; 
						div1.style.left= "0px";
						div1.style.marginTop= "-5px";
						div1.style.width= "500px";
						div1.style.height= "86%";					
						div1.style.fontSize="12px";						
						div.appendChild(div1);					
						for (var i = 1; i <= 4; i++){
							var obj = document.createElement("iframe");
							obj.id = "framegg" + i;
							//obj.className = "fixedBox";
							//obj.style.border= "none";
							obj.style.border= "1px solid #696969";
							obj.style.position= "relative"; 
							obj.style.float= "left"; 
							obj.style.left= "0px";
							//obj.style.marginTop= "-10px";
							obj.style.width= "48%";
							obj.style.height= "50%";					
							obj.style.fontSize="12px";						
							div1.appendChild(obj);					
						}
					}else{
						div1.style.display = "block";
					}
					getggdt();
				}else{
					ggdd = "多股"
					div1.style.display = "none";
					getggfs(ggdms,gp);					
					iframe.style.display = "block";	
					changeCss(objt,trid,"gg");
				}
			}
			
			function destroyIframe(iframeID){ 
				var iframe = document.getElementById(iframeID);
				iframe.src = 'about:blank'; 
				try{ 
					iframe.contentWindow.document.write(''); 
					iframe.contentWindow.document.clear(); 
				}catch(e){} 
			}
			
			$(function () {   //动态追加的元素触发事件
				$("body").delegate("input",
					"input propertychange",
					function () {						
						if($("#val1").val() != undefined){
							var t1 = $('#val1').val();						
							$('#fPrice1').text(t1 + '天');
							ts1 = t1;							
						}
						if($("#val2").val() != undefined){
							var t2 = $('#val2').val();
							$('#fPrice2').text(t2 + '天');
							ts2 = t2;
						}
						
					});
			});
			
			tz1 = 1;
			tz2 = 1;
			$(function () {   //动态追加的元素触发事件
				$("body").delegate("input",
					"change",
					function () {
						if($("#val1").val() != undefined){
							if(tz1 != $("#val1").val()){
								tz1 = $("#val1").val();								
								getbkfs(2);
							}
						}
						if($("#val2").val() != undefined){
							if(tz2 != $("#val2").val()){
								tz2 = $("#val2").val();								
								getggfs(ggdms,2);
							}
						}
					});
			});
			
		</script>		
	</body>
</html>